import Vue from 'vue'
import VueRouter from 'vue-router'
// import HelloWorld from "@/components/HelloWorld";
import Login from "../views/Login";
import Register from "../views/Register";
import RetrievePassword from "../views/RetrievePassword";
import Index from "../views/Index";
import Details from "@/components/Details";
import Background from "@/views/background/Background";
import BookList from "@/views/background/BookList";


Vue.use(VueRouter)
/*
const routes = [
  {
    path: '/',
    name: 'Index',
    component: Index
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/!* webpackChunkName: "about" *!/ '../views/About.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
  {
    path: '/retrievePassword',
    name: 'RetrievePassword',
    component: RetrievePassword
  },
  {
    path: '/details/:bookId',
    name: 'Details',
    component: Details
  },
    //后台管理
  {
    path: '/background',
    name: '商品信息',
    component: Background,
    children:[{
      path:'/bookList',
      name:'展示书籍',
      component: BookList
    }]
  }
]*/

/*const router = new VueRouter({
  routes
})*/

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes:[
    {
      path: '/',
      name: 'Index',
      component: Index
    },
    {
      path: '/about',
      name: 'About',
      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
    {
      path: '/retrievePassword',
      name: 'RetrievePassword',
      component: RetrievePassword
    },
    {
      path: '/details/:bookId',
      name: 'Details',
      component: Details
    },
    //购物车页面
    {
      path: '/cart',
      name: 'Cart',
      component: ()=>import('../views/Cart')
    },
    //支付页面
    {
      path: '/payment',
      name: 'Payment',
      component: ()=>import('../views/Payment')
    },
    //个人中心页面
    {
      path: '/personCenter',
      name: '个人中心',
      component: ()=>import('../views/person/Personal'),
      personShow: true,
      children: [

        //地址
        {
          path: '/address',
          name: '地址',
          personShow: true,
          component: ()=>import('../views/person/MyAddress')
        },
        //订单
        {
          path: '/order',
          name: '订单',
          personShow: true,
          component: ()=>import('../views/person/OrderInformation')
        },
        //我的收藏
        {
          path: '/collect',
          name: '我的收藏',
          personShow: true,
          component: ()=>import('../views/person/MyCollect')
        }
      ]
    },//我的信息
    {
      path: '/personCenter',
      name: '个人信息',
      personShow: true,
      component: ()=>import('../views/person/Personal'),
      children: [
        {
          path: '/information',
          name: '个人信息',
          personShow: true,
          component: ()=>import('../views/person/Information'),
        }
      ]
    },
    //阅读页面
    {
      path: '/read/:bookId',
      name: 'Read',
      component: ()=>import('../components/Read')
    },
    {
      path: '/search/:word',
      name: '搜索',
      component: ()=>import('../components/Search')
    },
    //后台管理
    {
      path: '/background',
      name: '商品信息',
      component: Background,
      show:true,
      children:[
        {
          path: '/bookList',
          name: '书籍列表',
          component: BookList,
          meta: {title:''},
          show: true
        },
        {
          path: '/addBook',
          name: '添加书籍',
          component: ()=>import('@/views/background/AddBook'),
          show: false
        },
        {
          path:'/alertBook',
          component: ()=>import('@/views/background/AlertBook'),
          show: false
        }
      ]
    },
    {
      path: '/background',
      name: '订单管理',
      show: true,
      component: ()=>import('../views/background/Background'),
      children: [
        {
          path: '/orders',
          name: '订单',
          show: true,
          component: ()=>import('../views/background/OrderInformation')
        }
      ]
    },
    {
      path: '/background',
      name: '添加轮播图',
      show: true,
      component: ()=>import('../views/background/Background'),
      children: [
        {
          path: '/addSlideShowManager',
          name:'管理',
          show: true,
          component: ()=>import('../views/background/SlideShowManager')
        },
        {
          path: '/addSlideShow',
          show: false,
          component: ()=>import('../views/background/AddSlideShow')
        }
      ]
    }

  ]
})


export default router

